/*
 * Create Map
 */


function CreateMap(mapDiv,url,options,format,lon,lat,wmsLayers,options_5) {

    var map = new OpenLayers.Map(mapDiv,options);


     
    var gphy = new OpenLayers.Layer.Google(
        "地形图",
        {
            type: G_PHYSICAL_MAP,
            "sphericalMercator" : true
        }
        );
    var gmap = new OpenLayers.Layer.Google(
        "行政区地图", // the default
        {
            "sphericalMercator" : true,
            numZoomLevels: 20
        }
        );
    var ghyb = new OpenLayers.Layer.Google(
        "卫星行政区图",
        {
            type: G_HYBRID_MAP,
            "sphericalMercator" : true,
            numZoomLevels: 20
        }
        );
    var gsat = new OpenLayers.Layer.Google(
        "卫星图",
        {
            type: G_SATELLITE_MAP,
            "sphericalMercator" : true,
             
            numZoomLevels: 22
        }
        );


    map.addLayers([gmap,gsat, ghyb,gphy]);
	
    var wms = new OpenLayers.Layer.WMS("道路",
        url,
        {
            singleTile: true,
            layers: 'BJMCC:bj_road_translate',//wmsLayers,
            srs:'EPSG:900913',
            format: format,
            transparent: true
        },options_5
        );
    wms.setVisibility(false);
    map.addLayer(wms);

    map.addLayers([gmap,gsat, ghyb,gphy]);
	
    var wms = new OpenLayers.Layer.WMS("水系",
        url,
        {
            singleTile: true,
            layers: 'BJMCC:river_translate',//wmsLayers,
            srs:'EPSG:900913',
            format: format,
            transparent: true
        },options_5
        );
    wms.setVisibility(false);
    map.addLayer(wms);

    var wms = new OpenLayers.Layer.WMS("建筑物",
        url,
        {
            singleTile: true,
            layers: 'BJMCC:building_translate',//wmsLayers,
            srs:'EPSG:900913',
            format: format,
            transparent: true
        },options_5
        );
    wms.setVisibility(false);
    map.addLayer(wms);
	
    var wms = new OpenLayers.Layer.WMS("GSM900天线",
        url,
        {
            singleTile: true,
            layers: 'BJMCC:fan_cells20110506_gsm900_translate',//wmsLayers,
            srs:'EPSG:900913',
            format: format,
            transparent: true
        },options_5
        );
    wms.setVisibility(false);
    map.addLayer(wms);
	
    var wms = new OpenLayers.Layer.WMS("GSM1800天线",
        url,
        {
            singleTile: true,
            layers: 'BJMCC:fan_cells20110506_gsm1800_translate',//wmsLayers,
            srs:'EPSG:900913',
            format: format,
            transparent: true
        },options_5
        );
    wms.setVisibility(false);
    map.addLayer(wms);
	
    var wms = new OpenLayers.Layer.WMS("GSM900边界",
        url,
        {
            singleTile: true,
            layers: 'BJMCC:border_gsm900_translate',//wmsLayers,
            srs:'EPSG:900913',
            format: format,
            transparent: true
        },options_5
        );
    wms.setVisibility(false);
    map.addLayer(wms);

    var wms = new OpenLayers.Layer.WMS("GSM1800边界",
        url,
        {
            singleTile: true,
            layers: 'BJMCC:border_gsm1800_translate',//wmsLayers,
            srs:'EPSG:900913',
            format: format,
            transparent: true
        },options_5
        );
    wms.setVisibility(false);
    map.addLayer(wms);

    var wms = new OpenLayers.Layer.WMS("投诉统计点",
        url,
        {
            singleTile: true,
            layers: 'BJMCC:tousu_translate',//wmsLayers,
            srs:'EPSG:900913',
            format: format,
            transparent: true
        },options_5
        );
    wms.setVisibility(false);
	
    map.addLayer(wms);

    var wms = new OpenLayers.Layer.WMS("掉话MR分布点",
        url,
        {
            singleTile: true,
            layers: 'BJMCC:traffic_tuanjiehu_position_translate',//wmsLayers,
            srs:'EPSG:900913',
            format: format,
            transparent: true
        },options_5
        );
    wms.setVisibility(false);
    map.addLayer(wms);

	
    map.addLayer(wms);

    var wms = new OpenLayers.Layer.WMS("GSM900场强",
        url,
        {
            singleTile: true,
            layers: 'BJMCC:field_gsm900_strength',//wmsLayers,
            srs:'EPSG:900913',
            format: format,
            transparent: true
        },options_5
        );
    wms.setVisibility(false);
    map.addLayer(wms);


    var wms = new OpenLayers.Layer.WMS("GSM1800场强",
        url,
        {
            singleTile: true,
            layers: 'BJMCC:field_gsm1800_strength',//wmsLayers,
            srs:'EPSG:900913',
            format: format,
            transparent: true
        },options_5
        );
    wms.setVisibility(false);
    map.addLayer(wms);

    var wms = new OpenLayers.Layer.WMS("GSM900干扰",
        url,
        {
            singleTile: true,
            layers: 'BJMCC:field_gsm900_interference_jzp_bcchno',//wmsLayers,
            srs:'EPSG:900913',
            format: format,
            transparent: true
        },options_5
        );
    wms.setVisibility(false);
    map.addLayer(wms);

    var wms = new OpenLayers.Layer.WMS("GSM1800干扰",
        url,
        {
            singleTile: true,
            layers: 'BJMCC:field_gsm1800_interference_jzp_bcchno',//wmsLayers,
            srs:'EPSG:900913',
            format: format,
            transparent: true
        },options_5
        );
    wms.setVisibility(false);
    map.addLayer(wms);

 

  singlecell = new OpenLayers.Layer.WMS("单天线覆盖范围",
        url,
        {
            singleTile: true,
            layers: 'BJMCC:borderview',//wmsLayers,
            viewparams: 'cellname:'+cellname,
            srs:'EPSG:900913',
            format: format,
            transparent: true
        },options_5
        );
    singlecell.setVisibility(false);
    map.addLayer(singlecell);

  singlegrid = new OpenLayers.Layer.WMS("网格归属天线",
        url,
        {
            singleTile: true,
            layers: 'BJMCC:fieldview',//wmsLayers,
            viewparams: 'grid_id:'+grid_id,
            srs:'EPSG:900913',
            format: format,
            transparent: true
        },options_5
        );
    singlegrid.setVisibility(false);
    map.addLayer(singlegrid);

  field900_line = new OpenLayers.Layer.WMS("GSM900网格归属天线画线",
        url,
        {
            singleTile: true,
            layers: 'BJMCC:field900_line',//wmsLayers,
            viewparams: 'grid_id:'+grid_id,
            srs:'EPSG:900913',
            format: format,
            transparent: true
        },options_5
        );
    field900_line.setVisibility(false);
    map.addLayer(field900_line);

  field1800_line = new OpenLayers.Layer.WMS("GSM1800网格归属天线画线",
        url,
        {
            singleTile: true,
            layers: 'BJMCC:field1800_line',//wmsLayers,
            viewparams: 'grid_id:'+grid_id,
            srs:'EPSG:900913',
            format: format,
            transparent: true
        },options_5
        );
    field1800_line.setVisibility(false);
    map.addLayer(field1800_line);

    //map.setCenter(new OpenLayers.LonLat(lon,lat), 40);
    //map.addControl(new OpenLayers.Control.PanZoomBar());
    map.addControl(new OpenLayers.Control.LayerSwitcher());
    //map.addControl(new OpenLayers.Control.MousePosition());
    //map.addControl(new OpenLayers.Control.MouseToolbar());
    map.addControl(new OpenLayers.Control.Permalink('shao'));
    //var overmap=new OpenLayers.Control.OverviewMap(options)
    map.addControl(new OpenLayers.Control.PanZoomBar());

    return map;
}

var createVectorLayer = function(map,vectorlayername) {
    vectorLayer = new OpenLayers.Layer.Vector(vectorlayername, {
        displayInLayerSwitcher: false
    });
    map.addLayer(vectorLayer);

    return vectorLayer;
};

